package com.why.catchMsg.common.exception;

import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
public class BizException extends RuntimeException{

    private static final long serialVersionUID = 1L;

    protected int errorCode;
    protected String errorMessage;

    public BizException() {
        super();
    }
    public BizException(String errorMessage) {
        super();
        this.errorMessage = errorMessage;
    }
    public BizException(int errorCode, String errorMessage) {
        super();
        this.errorCode = errorCode;
        this.errorMessage = errorMessage;
    }

    public BizException(BizErrorEnum bizError) {
        super();
        this.errorCode = bizError.getErrorCode();
        this.errorMessage = bizError.getErrorMessage();
    }

    public BizException(BizErrorEnum bizError, String detailMessage) {
        super();
        this.errorCode = bizError.getErrorCode();
        this.errorMessage = bizError.getErrorMessage() + detailMessage;
    }

    @Override
    public String toString() {
        return "BizException [ errorCode-" + errorCode + ", errorMessage-" + errorMessage + "]";
    }

}
